/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package org.opmviewer.prefuse;

import java.awt.Graphics2D;
import prefuse.Display;
import prefuse.util.display.PaintListener;

/**
 *
 * @author grzegorz
 */
public class OverviewPaintListener implements PaintListener {

    private Display overDisplay;

    public OverviewPaintListener(Display o) {
        overDisplay = o;
    }

    public void postPaint(Display d, Graphics2D g) {
        int x, y, w, h;
        if (d.getScale() != 0) {
            x = (int) (d.getDisplayX() / d.getScale());
            y = (int) (d.getDisplayY() / d.getScale());
            w = (int) (d.getWidth() / d.getScale());
            h = (int) (d.getHeight() / d.getScale());
        } else {
            x = (int) (d.getDisplayX());
            y = (int) (d.getDisplayY());
            w = (int) (d.getWidth());
            h = (int) (d.getHeight());
        }
        overDisplay.damageReport();
        overDisplay.repaint(x, y, w, h);
    }

    public void prePaint(Display d, Graphics2D g) {
    }
}
